package com.jhgk.jhcee.system.controller;

import com.jhgk.jhcee.common.resultful.BasisResultful;
import com.jhgk.jhcee.system.domain.model.SysMenuInfoModel;
import com.jhgk.jhcee.system.domain.model.SysMenuMetaRelationModel;
import com.jhgk.jhcee.system.service.SysMenuInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Description:
 * @Author: lemon_xzp
 * @Date: 2021/9/22 15:51
 */
@RestController
@RequestMapping("/menu")
@Api(value = "菜单信息", tags = {"菜单信息"})
public class SysMenuInfoController {

    @Resource(name = "SysMenuInfoServiceImpl")
    SysMenuInfoService sysMenuInfoService;

    @GetMapping("/getMenuList")
    @ApiOperation("获取用户所属菜单")
    public BasisResultful<Object> getMenuList() {
        return sysMenuInfoService.getMenuList();
    }

    @PostMapping("/getMenuMetaAllByPage")
    @ApiOperation("获取所有菜单记录_分页查询")
    public BasisResultful<Object> getMenuMetaAllList(@RequestBody SysMenuInfoModel model) {
        return sysMenuInfoService.getMenuMetaAllList(model);
    }

    @PostMapping("/getMenuMetaAll")
    @ApiOperation("获取所有菜单信息")
    public BasisResultful<Object> getMenuMetaAll() {
        return sysMenuInfoService.getMenuMetaAll();
    }

    @PostMapping("/addMenu")
    @ApiOperation("新增菜单")
    public BasisResultful<Object> addMenu(@RequestBody SysMenuMetaRelationModel model) {
        return sysMenuInfoService.addMenu(model);
    }

    @PutMapping("/updateMenu")
    @ApiOperation("更新菜单")
    public BasisResultful<Object> updateMenu(@RequestBody SysMenuMetaRelationModel model) {
        return sysMenuInfoService.updateMenu(model);
    }

    @DeleteMapping("/deleteMenu")
    @ApiOperation("删除菜单")
    public BasisResultful<Object> deleteMenu(@RequestBody SysMenuInfoModel model) {
        return sysMenuInfoService.deleteMenu(model);
    }


}
